package com.group3.Feign;

import com.group3.common.result.ApiResponse;
import com.group3.config.FeignConfiguration;
import com.group3.model.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value="ls-product-service", configuration = FeignConfiguration.class)
public interface ProductServiceFeign {

    @RequestMapping("/products/{pid}")
    public Product getProductByPid(@PathVariable Integer pid);

    @GetMapping("/products")
    public List<Product> getAllProducts();

    @PostMapping("/products/publish/{pid}")
    public ApiResponse publishProduct(@PathVariable Integer pid);

    @PostMapping("/products/unpublish/{pid}")
    public ApiResponse unpublishProduct(@PathVariable Integer pid);

     @RequestMapping("/product/decreaseStock")
    public boolean decreaseStock(@RequestParam("pid") Integer pid, @RequestParam("number") Integer number);

    @RequestMapping("/product/increaseStock")
    public boolean increaseStock(@RequestParam("pid") Integer pid, @RequestParam("number") Integer number);
}
